home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / util / rexx / supmacro11upd.lha / Save_Address1.1.arexx < prev    next >
Text File  |  1995-01-08  |  4KB  |  137 lines

  1. /*  Save_Address */
  2. /* A SuperMacro by Steven. R. Giovenella, 5823 Dutchess Dr., Colorado Springs, CO 
  3. 80918.  © Copyright 1994 Steven. R. Giovenella, All rights reserved. 
  4. This macro is my gift to the Amiga community.  It may be given away freely to 
  5. anyone, but it may NOT be sold in any way, shape, or form, not even for the cost of 
  6. reproduction, shipping, or handling, without express written permission from the 
  7. author.  This macro may NOT be added to any disk which is to be sold for any price 
  8. or fee, to include shipping and handling.  The ONLY way this macro may be 
  9. distributed is on a disk which is given away 100% free of all charges, or via 
  10. telecommunications networks which do not charge any additional fee as a result of a 
  11. user downloading this particular macro, although general fees for access to the 
  12. telecommunications system as a whole are acceptable.  This macro may only 
  13. bereproduced in its entirety, including all comment lines and code.  The individual 
  14. user may alter this macro for personal use, but may not then distribute the macro 
  15. in any modified form.  If you wish, feel free to send me some money, a Christmas 
  16. card, some other piece of software, or absolutely nothing as a gift for creating this 
  17. macro.  The author of this software is not responsible for any data loss or damage to 
  18. computer equipment as a result, direct or indirect, of the use of this macro. */
  19.  
  20. Options Results
  21.  
  22. /* Initialize*/
  23.     type " "
  24.     backspace
  25.  
  26. /* Open DataFile */
  27.     RequestText '"Save Address" "Enter destination Data File..." 
  28. "Address_DataFile"'
  29.         datafile=Result
  30.     file = "FWDocs/"||datafile
  31.     Open file
  32.     altdown
  33.     ctrldown
  34.     cursor down
  35.  
  36. /* Switch ARexx Addresses */
  37.     Status PortName
  38.         port=Result
  39.     portnumber=RIGHT(port,1)+1
  40.     newport=LEFT(port,7)||portnumber
  41.     ADDRESS VALUE newport
  42.  
  43. /* Goto to end of file */
  44.     AltDOWN
  45.     CtrlDOWN
  46.     Cursor DOWN
  47.     AltUP
  48.     CtrlUP
  49.  
  50. /* Get ending linenumber */
  51.     Status LinePos
  52.         Coords = Result
  53.         PARSE VAR Coords Line Pos
  54.  
  55. EnterAddress:
  56. /* Input record */
  57.     RequestText '"SAVE Address" "First name <Middle>.  (Line 1 of 9)" ""'
  58.         Address.1 = Result
  59.     RequestText '"SAVE Address" "Last name.  (Line 2 of 9)" ""'
  60.         Address.2 = Result
  61.     RequestText '"SAVE Address" "Company name.  (Line 3 of 9)" ""'
  62.         Address.3 = Result
  63.     RequestText '"SAVE Address" "Street address, line one.  (Line 4 of 9)" ""'
  64.         Address.4 = Result
  65.     RequestText '"SAVE Address" "Street address, line two.  (Line 5 of 9)" ""'
  66.         Address.5 = Result
  67.     RequestText '"SAVE Address" "City name.  (Line 6 of 9)" ""'
  68.         Address.6 = Result
  69.     RequestText '"SAVE Address" "State.  (Line 7 of 9)" ""'
  70.         Address.7 = Result
  71.     RequestText '"SAVE Address" "Zip Code.  (Line 8 of 9)" ""'
  72.         Address.8 = Result
  73.     RequestText '"SAVE Address" "Phone Number.  (Line 9 of 9)" ""'
  74.         Address.9 = Result
  75.  
  76. /* Format record (remove commas) */
  77.     DO j=1 to 8
  78.         DO i=1 to LENGTH(address.j)
  79.             IF RIGHT(LEFT(address.j , i) , 1) = "," THEN DO
  80.                 fronthalf = LEFT(address.j , (i-1))
  81.                 backhalf = RIGHT(address.j ,  LENGTH(address.j) - i)
  82.                 address.j = fronthalf || " " || backhalf
  83.                 END
  84.             END
  85.         END
  86.  
  87. /* Confirmation */
  88.     ShowMessage 1 0 '"Confirm that you wish to save this address." "" "" "Save" " 
  89. Re-Input Address " " Cancel "'
  90.         IF Result=2 THEN Call EnterAddress
  91.         IF Result=3 THEN DO
  92.             Close Force
  93.             Exit
  94.             END            
  95.  
  96. /* Insert Record */
  97.     type address.2
  98.     type ","
  99.     type address.1
  100.     type ","
  101.     DO i=3 to 9
  102.         type address.i
  103.         type ","
  104.         END
  105.     backspace
  106.     newparagraph
  107.         
  108. /* Select from line 2 position 0 to end-1 */
  109.     MoveToPara 2 0
  110.     ShiftDOWN
  111.     CtrlDOWN
  112.     AltDOWN
  113.     Cursor DOWN
  114.     AltUP
  115.     CtrlUP
  116.     Cursor UP
  117.  
  118. /* Sort */
  119.     Sort LowToHigh
  120.  
  121. /* Deselect */
  122.     Cursor DOWN
  123.     AltUP
  124.     CtrlUP
  125.     ShiftUP
  126.     MoveToLine 2 0
  127.  
  128. /* Set ASCII Prefs */
  129. ASCIIPrefs InsertNewLine YES InsertBlankLine YES
  130.  
  131. /* Save ASCII */
  132.     Save
  133.     Save ASCII "FWDocs/"datafile||".MergeFile"
  134.  
  135. /* Close DataFile */
  136.     Close FORCE 
  137.